package stage1.operation.module4.chat;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class ReceiveClientThreat implements Runnable {
    Socket socket;
    BufferedReader bReader;

    public ReceiveClientThreat(Socket socket) {
        super();
        this.socket = socket;
        try {
            bReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void run() {
        try {
            while (true) {
                String strMsg = bReader.readLine();
                if (null!=strMsg){
                    System.out.println(strMsg);
                }

            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
